<!doctype html>
<html lang="en">

<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="shortcut icon" type="image/x-icon" href="../../favicon.ico">
  <!-- Bootstrap CSS -->
  <link href="assetss/css/bootstrap.min.css" rel="stylesheet" />
  <link href="assetss/css/bootstrap-extended.css" rel="stylesheet" />
  <link href="assetss/css/style.css" rel="stylesheet" />
  <link href="assetss/css/icons.css" rel="stylesheet">

  <link rel="stylesheet" href="assetss/css/bootstrap-icons.css">

  <!-- loader-->
   <link href="assetss/css/pace.min.css" rel="stylesheet" />
   <!--光年-->
   <link href="../make/css/materialdesignicons.min.css" rel="stylesheet">
  

  <title></title>
</head>

<body>

  <!--start wrapper-->
  <div class="wrapper">

    <!--start content-->
    <main class="authentication-content">
      <div class="container-fluid">
        <div class="authentication-card">
          <div class="card shadow rounded-0 overflow-hidden">
            <div class="row g-0">
              <div class="col-lg-6 bg-login d-flex align-items-center justify-content-center">
                <!--<img src="assetss/images/error/login-img.jpg" class="img-fluid" alt="">-->
                <img id="reuser" src="" class="img-fluid" alt="图片">
              </div>
              <div class="col-lg-6">
                <div class="card-body p-4 p-sm-5">
                  <h5 class="card-title">注册账号</h5>
                  <p class="card-text mb-5">成为我们的代理商，无限可能!</p>
                  <form class="form-body">
                    <div class="login-separater text-center mb-4"> <span>OR SIGN UP WITH ACCOUNT</span>
                      <hr>
                    </div>
                    <div class="row g-3">
                      <div class="col-12 ">
                        <label for="inputName" class="form-label">注册账号</label>
                        <div class="ms-auto position-relative">
                          <div class="position-absolute top-50 translate-middle-y search-icon px-3"><i class="mdi mdi-account-circle"></i></div>
                          <input type="text" class="form-control radius-30 ps-5" id="account" placeholder="请输入账号" required>
                        </div>
                      </div>
                      <div class="col-12">
                        <label for="inputEmailAddress" class="form-label">注册密码</label>
                        <div class="ms-auto position-relative">
                          <div class="position-absolute top-50 translate-middle-y search-icon px-3"><i class="mdi mdi-lock-open-outline"></i></div>
                          <input type="password" class="form-control radius-30 ps-5" id="password" placeholder="请输入密码" required>
                        </div>
                      </div>
                     <div class="col-12 ">
                        <label for="inputUsername" class="form-label">店铺名称</label>
                        <div class="ms-auto position-relative">
                          <div class="position-absolute top-50 translate-middle-y search-icon px-3"><i class="mdi mdi-cow"></i></div>
                          <input type="text" class="form-control radius-30 ps-5" id="username" placeholder="请输入代理名称" required>
                        </div>
                      </div>
                      <div class="col-12">
                        <label for="inputChoosePassword" class="form-label">邀请码</label>
                        <div class="ms-auto position-relative">
                          <div class="position-absolute top-50 translate-middle-y search-icon px-3"><i class="bx bx-code-alt"></i></div>
                          <input type="text" class="form-control radius-30 ps-5" id="puid" placeholder="填写邀请码" required>
                        </div>
                      </div>
                    </div>
                    <div class="col-12" style="margin-top:20px;margin-bottom:20px;">
                      <div class="form-check form-switch">
                        <input class="form-check-input" type="checkbox" id="flexSwitchCheckChecked" checked>
                        <label class="form-check-label" for="flexSwitchCheckChecked">我同意
                          <a href="">用户注册协议</a>和
                          <a href="">平台隐私政策</a>
                        </label>
                      </div>
                    </div>
                    <div class="col-12">
                      <div class="d-grid">
                        <button type="submit" class="btn btn-primary radius-30">立即注册</button>
                      </div>
                    </div>
                    <div class="col-12" style="margin-top:20px;">
                      <p class="mb-0">已有账号? <a href="login.html">去登录</a></p>
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <footer class="footer">
            <div class="container">
                <div class="row align-items-center flex-row-reverse">
                    <div class="col-md-12 col-sm-12 text-center">
                        Copyright ©  <a href="javascript:void(0)" id = "site_name">阔景科技版权所有 </a> All rights reserved.
                        <span id="year"></span> <a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank" id = "site_icp">icp备案 </a>
                    </div>
                </div>
            </div>
        </footer>
    </main>

    <!--end page main-->

  </div>
  <!--end wrapper-->

  <!--plugins-->
  <script src="assetss/js/jquery.min.js"></script>
  <script src="assetss/js/pace.min.js"></script>

<script>
    $(function() {
          // 发送 Ajax 请求获取网站参数值
          $.ajax({
            type: "GET",
            url: "controller/public/WebConfig.php",
            dataType: "json",
            success: function(response) {
              // 在页面上渲染参数值
              $("#site_name").text(response.site_name);
              $("#site_seo").text(response.site_seo);
              $("#site_key").text(response.site_key);
              $("#site_ms").text(response.site_ms);
              $("#reuser").attr("src", response.reuser);
              $("#loginuser").attr("src", response.loginuser);
              $("#site_icp").text(response.site_icp);
               // 修改页面标题
              document.title = response.site_name + " - 注册成为我们的代理商";
            },
            error: function() {
              alert("服务器连接失败，请重试！");
            }
          });
        });



  $(document).ready(function() {
    // 获取传递的puid参数
    var puid = getUrlParameter('puid');
    if (puid !== '') {
      // 将puid填充到邀请码输入框中
      $("#puid").val(puid);
    }

    // 提交表单数据
    $("form").submit(function(e) {
      e.preventDefault(); // 阻止表单默认提交行为

      // 获取表单数据
      var account = $("#account").val();
      var password = $("#password").val();
      var username = $("#username").val();
      var puid = $("#puid").val();

      // 创建要提交的数据对象
      var formData = {
        account: account,
        password: password,
        puid: puid,
        username:username,
      };

      // 发起Ajax请求
      $.ajax({
        type: "POST",
        url: "controller/Resgin.php",
        data: formData,
        success: function(response) {
          // 处理成功响应的代码
        //   console.log(response);
        alert(JSON.parse(response).msg)
            // alert(response.msg);
            if (JSON.parse(response).code === 2) {
                // 跳到登录页
                window.location.href = "login.html";
            }
        },
        error: function(xhr) {
          // 请求失败后的处理
        //   console.log(xhr.responseText);
          alert('系统出错，请稍后再试');
        }
      });
    });
  });

  // 获取URL参数的函数
  function getUrlParameter(name) {
    name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(location.search);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
  }
</script>

</body>

</html>
 
